package com.kpa.demo.data.http.interceptor

import com.google.gson.Gson
import okhttp3.ResponseBody
import retrofit2.Converter
import retrofit2.Retrofit
import java.lang.reflect.Type

class ResponseConverterFactory private constructor(): Converter.Factory() {

    override fun responseBodyConverter(
        type: Type,
        annotations: Array<Annotation>,
        retrofit: Retrofit
    ): Converter<ResponseBody, *>? {
        return ResponseBodyConverter<Type>(Gson(), type)
    }

    companion object {
        fun create() = ResponseConverterFactory()
    }
}